<template>
  <div>
    <el-card v-for="(item,key) in list" :key="key" style="margin-bottom: 20px;">
      <div style="display: flex;justify-content: space-between">
        <div>
          <div style="width: 100%;font-size: 14px">
            {{ item.content }}
          </div>
          <div class="bottom clearfix">
            <time class="time" style="font-size: 12px;color: #707070">{{ item.createDateTime }}</time>
          </div>
        </div>
        <el-button type="danger" size="mini" @click="del(item.messageId)">删除</el-button>
      </div>
    </el-card>
  </div>
</template>

<script>

import leaveWord from "@/api/leaveWord";

export default {
  name: 'personLeaveWord',
  data() {
    return {
      list: []
    };
  },
  mounted() {
    this.$nextTick(() => {
      this.getList()
    })
  },
  methods: {
    async getList() {
      console.log(this.globalVariable.userGlobalConst)
      let res = await leaveWord.list(this.globalVariable.userGlobalConst.userId)
      this.list = res.data
    },
    async del(id) {
      let res = await leaveWord.del({id})
      if (res.code === 200) {
        this.$message.success('删除成功')
        this.getList()
      }
    }
  }
};
</script>

<style scoped>

</style>
